<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
        .main {
            width: 900px;
            height: 500px;
            margin: 50px auto;
            text-align: center;
        }
        .box {
            width: 800px;
            height: 400px;
            margin: 0 auto;
            border: 1px solid #ccc;
           
        }
        h4 {
            height: 50px;
            line-height: 50px;
        }
        nav {
            position: relative;
            border-bottom: 1px solid #ccc;
        }
        nav ul{
            overflow: hidden;
        }
        nav li {
            /* box-sizing: border-box;  */
            position: relative;
            float: left;
            height: 60px;
            width: 80px;
            line-height: 60px;
            text-align: center;
            border-right: 1px solid #ccc;
        }
        nav ul li span:last-child{
            position: absolute;
            font-size: 12px;
            user-select: none;
            top: -24px;
            right: 0;
        }
        .tabadd {
            position: absolute;
            top: 7px;
            right: 7px;
        }
        .tabadd::before{
            content: '+';
            display: block;
            width: 20px;
            height: 20px;
            text-align: center;
            line-height: 20px;
            border: 1px solid #ccc;
        }
        nav ul li.liactive{
           background-color: orange;
/* z-index: 999; */
        }
        .tavscon section {
                display: none;

        }
        .tavscon section.conactive{
            display: block;
        }
    </style>
</head>
<body>
    <div class="main">
    <h4>tab切换</h4>
    <div class="box" id="tab">
<nav>
<ul>
    <li class="liactive"><span>测试1</span><span class="iconfont icon-guanbi"></span></li>
    <li><span>测试2</span><span class="iconfont icon-guanbi"></span></li>
    <li><span>测试3</span><span class="iconfont icon-guanbi"></span></li>
</ul>
<div class="tabadd"></div>
</nav>
<div class="tavscon">
    <section class="conactive">测试1</section>
    <section>测试2</section>
    <section>测试3</section>
</div>
    </div>

</div>
<script src="tab.js"></script>
</body>
</html>